<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
    //转字符型：数值、布尔、null、未定义
    let num1 = 123,flag1 = true, flag2 = false,num2 = null,num3;
    //String(),toString()
    let str1= String(num1);
    console.log(str1);  //123
    console.log(typeof(str1));
    str1 = num1.toString();
    console.log(str1);  //123
    console.log(typeof(str1));
    console.log('-------');
    console.log(String(flag1));
    console.log(flag1.toString());
    console.log(String(flag2));
    console.log(flag2.toString());
    console.log('-----------');
    console.log(String(num2));
    // console.log(num2.toString());      //null没有tostring()方法
    console.log(String(num3));
    //




</script>
</html>